package com.project.queue.tool;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author mengxj
 */
@Component
public class KafkaQueue extends BaseQueue{

    private static KafkaQueue kafkaQueue;

    @Resource
    public void setKafkaQueue(KafkaQueue kafkaQueue) {
        KafkaQueue.kafkaQueue = kafkaQueue;
    }

    public static KafkaQueue getInstance(){
        return kafkaQueue;
    }

    @Resource
    private KafkaTemplate<String, String> kafkaTemplate;

    @Override
    public void send(String queue, String value) {
        this.kafkaTemplate.send(queue, value);
    }
}
